$(document).ready(function () { $("#navcur" + topid).addClass("cur"); //$("#nlink" + id).addClass("nlink"); // $("#nlink" + hpid).addClass("nlink"); // $("#nlink" + hpid).parent().addClass("navtog_up"); // $("#nlink" + hpid).next().show(); // $(".navtog").click(function () { // var topli = $(this).parent(); // if (topli.hasClass("navtog_up")) { // $(this).parent().removeClass("navtog_up"); // $(this).next("ul").slideUp(); // } // else { // $(this).parent().addClass("navtog_up"); // $(this).next("ul").slideDown(); // } // }); isImgLoad(function () { autoImage(".piclist", 280, 280); autoImage(".pedshow", 205, 205); }); }); //ÅжÏͼƬÊÇ·ñ¼ÓÔØÍê³É var t_img; var isLoad = true; function isImgLoad(callback) { $(".cover").each(function () { if (this.height === 0) { isLoad = false; return false; } }); if (isLoad) { clearTimeout(t_img); callback(); } else { isLoad = true; t_img = setTimeout(function () { isImgLoad(callback); }, 500); } } function autoImage(cid, width, height) { $(cid).each(function () { var t = $(this); var src = $(this).attr("src"); var img = new Image(); img.src = src; if (img.width > 0 && img.height > 0) { if (img.width / img.height >= width / height) { if (img.width > width) { t.width(width); t.height((img.height * width) / img.width); } else { t.width(img.width); t.height(img.height); } } else { if (img.height > height) { t.height(height); t.width((img.width * height) / img.height); } else { t.width(img.width); t.height(img.height); } } } }) } function load_ScrollTop(strID, strFixed, strRemo, intHeight) { var scroll_tf = $(strID).offset().top; var scroll_Reco = $(strRemo).offset().top; $(window).scroll(function () { if ($(window).scrollTop() >= (scroll_Reco - intHeight)) { $(strID).removeClass(strFixed); } else if ($(window).scrollTop() >= scroll_tf) { $(strID).addClass(strFixed); } else { $(strID).removeClass(strFixed); } }); }